home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
serien
/
purity
/
nr.51
/
xpk
/
docs
/
xpk.doc
< prev
next >
Wrap
Text File
|
1995-08-27
|
16KB
|
500 lines
TABLE OF CONTENTS
xpkmaster.library/XpkClose
xpkmaster.library/XpkExamine
xpkmaster.library/XpkExamineTags
xpkmaster.library/XpkOpen
xpkmaster.library/XpkOpenTags
xpkmaster.library/XpkPack
xpkmaster.library/XpkPackTags
xpkmaster.library/XpkQuery
xpkmaster.library/XpkQueryTags
xpkmaster.library/XpkRead
xpkmaster.library/XpkUnpack
xpkmaster.library/XpkUnpackTags
xpkmaster.library/XpkWrite
xpkmaster.library/--tags--
xpkmaster.library/--progress--
xpkmaster.library/XpkClose xpkmaster.library/XpkClose
NAME
XpkClose - Close an XPK-File
SYNOPSIS
err = XpkClose( xfh )
D0 A0
LONG XpkClose(struct XpkFH *)
FUNCTION
Frees all resources associated with packing or unpacking an
XPK-File. Note that this may well fail, especially on packing,
since additional writes have to be made here.
INPUT
xfh - The XpkFH obtained from XpkOpen()
RESULT
err - Global Xpk error code
SEE ALSO
XpkOpen(), XpkRead(), XpkWrite()
xpkmaster.library/XpkExamine xpkmaster.library/XpkExamine
NAME
XpkExamine - Get information about a compressed file
SYNOPSIS
err = XpkExamine(fib, tags)
D0 A0 A1
LONG XpkExamine(struct XpkFib *, struct TagItem *)
FUNCTION
Returns information about compressed data. The output is written
to the XpkFib structure whose address is passed with the mandatory
XPK_FileExamine tag. You also have to specify an XPK_In* tag. Note
that the file position of the in hook will not be altered.
INPUT
tags - Pointer to an array of struct TagItem. You may use
either a XPK_InBuf, a XPK_InName, XPK_InFH or XPK_InHook
tag.
RESULT
err - Global Xpk error code
SEE ALSO
libraries/xpk.h, xDir.c
xpkmaster.library/XpkExamineTags xpkmaster.library/XpkExamineTags
NAME
XpkExamineTags - Get information about a compressed file
SYNOPSIS
err = XpkExamineTags(fib, tag1, val1, tag2, val2, .... , TAG_DONE )
D0
LONG XpkExamineTags(ULONG, ... );
FUNCTION
Same as XpkExamine(), but tags passed on stack. This is a link-
library function, you'll need to link with xpk<compiler>.lib .
SEE ALSO
XpkExamine()
xpkmaster.library/XpkOpen xpkmaster.library/XpkOpen
NAME
XpkOpen - Open a compressed file for partial reading
SYNOPSIS
err = XpkOpen(xfh,tags)
D0 A0 A1
LONG XpkOpen( struct XpkFH **xfh,struct TagItem *)
FUNCTION
Using XpkOpen you can read or write an XPK-File without ever having
all of the file present in RAM. On reading, you cannot pick the
size of the chunks; they're given by the file to be decompressed
and may be up to the whole size of the file.
INPUT
xfh - Address of a pointer to struct XpkFH
tags - Specifying XPK_PackMethod will chose packing mode for
this filehandle. Only In-tags are permitted in case
of unpacking, and only Out-tags are in case of packing.
Anything else will yield undefined results. Progress
reports not supported. When packing, you must supply
XPK_InLen as well.
RESULT
xfh - The filehandle. Consists of an xfib and some private
information. The NLen field in the xfh indicates the
length of the next chunk.
err - Global Xpk error code. If nonzero, no xfh was allocated.
Check the XPK_GetError to see how to get a full err msg.
SEE ALSO
XpkRead(), XpkWrite(), XpkClose(), xpkmaster.library/tags, examples/
xpkmaster.library/XpkPack xpkmaster.library/XpkPack
NAME
XpkPack - Compress a data stream
SYNOPSIS
err = XpkPack(tags)
D0 A0
LONG XpkPack(struct TagItem *);
FUNCTION
Compresses a file or a memory area to a different file or memory
area. You need to specify at least one XPK_In... tag, at least
one XPK_Out... tag, plus XPK_PackMethod.
INPUT
tags - Pointer to an array of struct TagItem. See xpkmaster/tags
RESULT
err - Global Xpk error code, see xpk.h. Check the XPK_GetError
to see how to get a full err msg.
SEE ALSO
xpkmaster.library/tags, xpk.c
xpkmaster.library/XpkPackTags xpkmaster.library/XpkPackTags
NAME
XpkPackTags - Compress a data stream
SYNOPSIS
err = XpkPackTags(tag1, val1, tag2, val2, .... , TAG_DONE )
D0
LONG XpkPackTags(ULONG, ... );
FUNCTION
Same as XpkPack(), but tags passed on stack. This is a link-
library function, you'll need to link with xpk<compiler>.lib .
SEE ALSO
XpkPack()
xpkmaster.library/XpkQuery xpkmaster.library/XpkQuery
NAME
XpkQuery - Gain information about packers
SYNOPSIS
err = XpkQuery( tags )
D0 A0
LONG XpkQuery( tags );
FUNCTION
Finds out a list of available packers or various parameters of a
packer. When using the tag XPK_PackersQuery, you must supply a
XpkPackerList structure and will receive a list of available
packers. The second possibility, XPK_PackerQuery, expects a
pointer to a XpkPackerInfo structure which will be filled in with
information about a packer, and XPK_ModeQuery fills in a XpkMode
structure with information about some mode (or the default mode)
of a packer. XPK_PackMethod must be present among the tags for
the latter two, and XPK_PackMode can be for ModeQuery.
RESULT
err - Global Xpk error code. XPK_GetError also supported
SEE ALSO
libraries/xpk.h
xpkmaster.library/XpkQueryTags xpkmaster.library/XpkQueryTags
NAME
XpkQueryTags - Gain information about packers
SYNOPSIS
err = XpkQueryTags(tag1, val1, tag2, val2, .... , TAG_DONE )
D0
LONG XpkQueryTags(ULONG, ... );
FUNCTION
Same as XpkQuery(), but tags passed on stack. This is a link-
library function, you'll need to link with xpk<compiler>.lib .
SEE ALSO
XpkQuery()
xpkmaster.library/XpkRead xpkmaster.library/XpkRead
NAME
XpkRead - Unpack one part of an XPK-File
SYNOPSIS
read = XpkRead( xfh, buf, len )
D0 A0 A1 D0
LONG XpkRead(struct XpkFH *, UBYTE *, LONG)
FUNCTION
Reads one chunk from an XPK-file and decompresses it to the
memory area indicated.
INPUT
xfh - The XpkFH obtained from XpkOpen(). It must be a read-
handle, ie. there was no XPK_PackMethod tag among the
tags passed to XpkOpen().
buf - The memory area to write the destination to
len - The number uncompressed bytes to output. Note that you
can't choose these freely but must take them from
the NLen field in the xfh.
RESULT
read - The number of bytes read. 0 indicates EOF, negative
numbers are global error codes. Long error messages
written to buffer passed through XPK_GetError in
XpkOpen(). This number of bytes read will usually be
smaller than the number requested!
SEE ALSO
XpkOpen(), XpkWrite(), XpkClose(), examples/
xpkmaster.library/XpkUnpack xpkmaster.library/XpkUnpack
NAME
XpkUnpack - Decompress a data stream
SYNOPSIS
err = XpkUnpack(tags)
D0 A0
LONG XpkUnpack(struct TagItem *);
FUNCTION
Decompresses a file or a memory area to a different file or memory
area. You need to specify at least one XPK_In... tag, at least
one XPK_Out... tag.
INPUT
tags - Pointer to an array of struct TagItem. See xpkmaster/tags
RESULT
err - Global Xpk error code.
SEE ALSO
xpkmaster.library/tags
xpkmaster.library/XpkUnpackTags xpkmaster.library/XpkUnpackTags
NAME
XpkUnpackTags - Decompress a data stream
SYNOPSIS
err = XpkUnpackTags(tag1, val1, tag2, val2, .... , TAG_DONE )
D0
LONG XpkUnpackTags(ULONG, ... );
FUNCTION
Same as XpkUnpack(), but tags passed on stack. This is a link-
library function, you'll need to link with xpk<compiler>.lib.
SEE ALSO
XpkUnpack()
xpkmaster.library/XpkWrite xpkmaster.library/XpkWrite
NAME
XpkWrite - Pack one part of an XPK-File
SYNOPSIS
read = XpkWrite( xfh, buf, len )
D0 A0 A1 D0
LONG XpkWrite(struct XpkFH *, UBYTE *, LONG)
FUNCTION
Compresses the memory area indicated and writes it to an
XPK-File.
INPUT
xfh - The XpkFH obtained from XpkOpen(). Must be a write-
handle, ie. XPK_PackMethod must have been among the
tags passed to XpkOpen().
buf - The memory area to compress
len - The number bytes to compress. Note you may not choose
them freely, you must always deliver as many bytes
as the NLen field of the XFH indicates. You may try
to influence it by passing XPK_ChunkLen to XpkOpen().
Important: The first chunk written *must* be the
biggest!
RESULT
written - The number of bytes written. 0 indicates EOF, negative
numbers are global error codes. Error messages are
written to buffer passed through XPK_GetError in
XpkOpen().
SEE ALSO
XpkOpen(), XpkRead(), XpkClose(), examples/
xpkmaster.library/--tags-- xpkmaster.library/--tags--
THE TAGS FOR XpkPack() AND XpkUnpack()
THE INPUT TAGS. One of the four must be present.
XPK_InName (char *)
Name of file to (de)compress. On packing, XPK_InLen can be
specified in order to pack only the first N bytes. On de-
compression, only one file will be decompressed, even if
there are additional data at the end.
XPK_InFH (BPTR)
File handle to (de)compress from. It is not necessary that
the handle is at the beginning of the file. Otherwise same
rules as in XPK_InName apply.
XPK_InBuf (UBYTE *)
Memory block to (de)compress. If you use this one, you
have to specify InLen as well.
XPK_InHook (struct Hook *)
Hookfunc to deliver data for (de)compression. See special
chapter on I/O hook functions. Must also supply XPK_InLen.
IN ADDITION
XPK_InLen (LONG)
Specifies the number of bytes to read when compressing.
gnored on decompression.
THE OUTPUT TAGS. One of the five must be present.
XPK_OutName (char *)
Name of file write (de)compressed data to.
XPK_OutFH (BPTR)
File handle to append (de)compressed data to.
XPK_OutBuf (APTR)
The memory block to write (de)compressed data to. Must also
supply XPK_OutBufLen. On packing, its size must be at least
inlen+inlen/32+2*XPK_MARGIN. On unpacking, it needs only be
outlen+XPK_MARGIN. Use XpkExamine() to find out outlen. Note
that this buffer must be word aligned.
XPK_GetOutBuf (APTR *)
Allocates a block of appropriate size and stores a pointer to
it in the variable pointed to by ti_Data. Must also supply
XPK_GetOutBufLen plus XPK_GetOutLen and can XPK_OutMemType.
XPK_OutHook (struct Hook *)
Hookfunc to accept (de)compressed data. See special chapter
on I/O hook functions.
IN ADDITION
XPK_OutBufLen (LONG)
The length of the output buffer you supply using XPK_OutBuf.
For decompression, must be decompressed size (see XpkExamine())
plus XPK_MARGIN. For compression, inlen+inlen/32+2*XPK_MARGIN.
XPK_GetOutLen (LONG *)
Stores the total length of the (de)compressed data in the variable
pointed to by ti_Data. Note: V2 of xpkmaster required for correct
operation on compression.
XPK_GetOutBufLen (LONG *)
Stores the length of the buffer allocated for the data in the
variable pointed to by ti_Data. FreeMem() the buffer you get
from XPK_GetOutBuf with the length you get from XPK_GetOutBufLen.
Note: For the number of bytes written, refer to XPK_GetOutLen!
XPK_OutMemType (LONG)
The type of memory to use for the output buffer.
PACKING TAGS
XPK_PackMethod (char *)
Use indicated method for packing. This would be a four
letter string in most cases, plus an optional dot and
a packing mode. See XPK_PackMode
XPK_PackMode (LONG)
Packing mode for sublib to use. Range is 0...100, where 100 is
most efficient.
XPK_StepDown (BOOL)
Reduce packing efficiency to save mem if necessary.
XPK_ChunkSize (LONG)
Chunk size to try to pack with. May be altered by the
master library.
QUERY TAGS
XPK_PackersQuery (struct XpkPackerList *)
Returns an array of available packers names in the XPLIST
structure whose address is stored in the ti_Data field
of this tag.
XPK_PackerQuery (struct XpkPackerInfo *)
Returns information about one single packer in the XPINFO
structure whose address is stored in the ti_Data field
of this tag. See libraries/xpk.h for the meaning of the
fields therein. You must also supply XPK_PackMode.
XPK_ModeQuery (struct XpkMode *)
Returns information about one single packer mode in the
XPINFO structure whose address is stored in the ti_Data
field of this tag. See libraries/xpk.h for the meaning of
the fields therein. You must also supply XPK_PackMethod
and optionally XPK_PackMode (or a mode in the PackMethod
string), otherwise the default mode will be used.
OTHER TAGS
XPK_GetError (char *)
Write error msg to the buffer passed. The buffer must be of
size XPKERRMSGSIZE.
XPK_ShortError (BOOL)
Don't include activity and file name in error messages.
XPK_Password (char *)
Use password for en- or decoding. Passing a NULL pointer or
zero length string is equivalent to omitting this tag.
XPK_ChunkHook (struct Hook *)
Hook function to call between chunks. Can print a progress
report, and if it returns a nonzero value, the (de)compression
will be aborted. See special chapter on chunk functions.
XPK_PassThru (BOOL)
If true, data will just be handed trough on decompression if they
were not packed. Otherwise you get XPKERR_NOTPACKED.
XPK_TaskPri (UBYTE)
The task priority to use during the (de)crunching. Use -1 for
background decompression.
XPK_FileName (STRPTR)
The name to print in the progress report. If none is given, the
InName will be used when packing and the OutName when unpacking.
xpkmaster.library/--progress-- xpkmaster.library/--progress--
THE PROGRESS REPORT HOOK
The progress report function is a standard hook function that will
be called after every chunk (de)compressed. This will be about
every 30K, or just twice if the file format is not split in chunks.
If the field h_Entry in the hook is set, it will be called with
the hook itself in a0 and the progress report structure in a1.
If your compiler does not support direct calling in registers,
it must have a library function that puts the arguments that
puts the arguments wherever the functions needs them and call it.
A4 is guaranteed to be saved so it is not necessary to provide
geta4() or __saveds in C programs. If the progress report function
returns a nonzero value, (de)compression aborts. Note: it is YOUR
responsibility to turn off your compiler's CTRL-C-handling e.g. if
you do printf()s in the chunk function!
THE PROGRESS REPORT STRUCTURE
LONG Type : XPKPROG_START, XPKPROG_MID or XPKPROG_END
STRPTR PackerName : Brief name of packer being used
STRPTR PackerLongName : Descriptive name of packer being used
STRPTR Activity : Packing/unpacking message
STRPTR FileName : Name of file being processed, if available
LONG CCur : Amount of packed data already processed
LONG UCur : Amount of unpacked data already processed
LONG ULen : Amount of unpacked data in file
LONG CF : Compression factor so far
LONG Done : Percentage done already
LONG Speed : Bytes per second, from beginning of stream